import { NgModule } from '@angular/core';
import { Routes,
     RouterModule } from '@angular/router';

import { UserComponent } from './user.component';

import { UserAddComponent } from './user-add/user-add.component';

import { UserEditComponent } from './user-edit/user-edit.component';

const routes: Routes = [

  {
    path: '',
    redirectTo: 'list',
    pathMatch: 'full',
  },
  {
    path: '',
    data: {
      title: '用户管理',
    },
    children: [
      {
        path: 'list',
        component: UserComponent,
        data: {
          title: '用户列表'
        }
      },
      {
        path: 'add',
        component:UserAddComponent ,
        data: {
          title: '新增用户'
        }
      },
      {
        path: 'edit/:id',
        component:UserEditComponent ,
        data: {
          title: '修改用户'
        }
      },
    ]
  }
];

@NgModule({
  imports: [RouterModule.forChild(routes)],
  exports: [RouterModule]
})
export class UserRoutingModule {}
